home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / CodeWarrior Lite / Metrowerks C⁄C++ Lite / Headers / Universal Headers 2.0.1f / AppleEvents.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-22  |  27.1 KB  |  576 lines  |  [TEXT/MMCC]

  1. /*
  2.      File:        AppleEvents.h
  3.  
  4.      Contains:    AppleEvent Package Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.0 in “MPW Latest” on ETO #17
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. */
  19.  
  20. #ifndef __APPLEEVENTS__
  21. #define __APPLEEVENTS__
  22.  
  23.  
  24. #ifndef __ERRORS__
  25. #include <Errors.h>
  26. #endif
  27. /*    #include <ConditionalMacros.h>                                */
  28.  
  29. #ifndef __TYPES__
  30. #include <Types.h>
  31. #endif
  32.  
  33. #ifndef __MEMORY__
  34. #include <Memory.h>
  35. #endif
  36. /*    #include <MixedMode.h>                                        */
  37.  
  38. #ifndef __OSUTILS__
  39. #include <OSUtils.h>
  40. #endif
  41.  
  42. #ifndef __EVENTS__
  43. #include <Events.h>
  44. #endif
  45. /*    #include <Quickdraw.h>                                        */
  46. /*        #include <QuickdrawText.h>                                */
  47.  
  48. #ifndef __EPPC__
  49. #include <EPPC.h>
  50. #endif
  51. /*    #include <AppleTalk.h>                                        */
  52. /*    #include <Files.h>                                            */
  53. /*    #include <PPCToolbox.h>                                        */
  54. /*    #include <Processes.h>                                        */
  55.  
  56. #ifndef __NOTIFICATION__
  57. #include <Notification.h>
  58. #endif
  59.  
  60. #ifdef __cplusplus
  61. extern "C" {
  62. #endif
  63.  
  64. #if PRAGMA_ALIGN_SUPPORTED
  65. #pragma options align=mac68k
  66. #endif
  67.  
  68. #if PRAGMA_IMPORT_SUPPORTED
  69. #pragma import on
  70. #endif
  71.  
  72.  
  73. enum {
  74. /* Apple event descriptor types */
  75.     typeBoolean                    = 'bool',
  76.     typeChar                    = 'TEXT',
  77.     typeSMInt                    = 'shor',
  78.     typeInteger                    = 'long',
  79.     typeSMFloat                    = 'sing',
  80.     typeFloat                    = 'doub',
  81.     typeLongInteger                = 'long',
  82.     typeShortInteger            = 'shor',
  83.     typeLongFloat                = 'doub',
  84.     typeShortFloat                = 'sing',
  85.     typeExtended                = 'exte',
  86.     typeComp                    = 'comp',
  87.     typeMagnitude                = 'magn',
  88.     typeAEList                    = 'list',
  89.     typeAERecord                = 'reco',
  90.     typeAppleEvent                = 'aevt',
  91.     typeTrue                    = 'true',
  92.     typeFalse                    = 'fals',
  93.     typeAlias                    = 'alis',
  94.     typeEnumerated                = 'enum',
  95.     typeType                    = 'type',
  96.     typeAppParameters            = 'appa',
  97.     typeProperty                = 'prop',
  98.     typeFSS                        = 'fss ',
  99.     typeKeyword                    = 'keyw',
  100.     typeSectionH                = 'sect',
  101.     typeWildCard                = '****',
  102.     typeApplSignature            = 'sign',
  103.     typeQDRectangle                = 'qdrt',
  104.     typeFixed                    = 'fixd',
  105.     typeSessionID                = 'ssid',
  106.     typeTargetID                = 'targ',
  107.     typeProcessSerialNumber        = 'psn ',
  108.     typeNull                    = 'null',                        /* null or nonexistent data */
  109. /* Keywords for Apple event parameters */
  110.     keyDirectObject                = '----',
  111.     keyErrorNumber                = 'errn',
  112.     keyErrorString                = 'errs',
  113.     keyProcessSerialNumber        = 'psn ',
  114. /* Keywords for Apple event attributes */
  115.     keyTransactionIDAttr        = 'tran',
  116.     keyReturnIDAttr                = 'rtid',
  117.     keyEventClassAttr            = 'evcl',
  118.     keyEventIDAttr                = 'evid',
  119.     keyAddressAttr                = 'addr',
  120.     keyOptionalKeywordAttr        = 'optk',
  121.     keyTimeoutAttr                = 'timo',
  122.     keyInteractLevelAttr        = 'inte',                        /* this attribute is read only - will be set in AESend */
  123.     keyEventSourceAttr            = 'esrc',                        /* this attribute is read only */
  124.     keyMissedKeywordAttr        = 'miss',                        /* this attribute is read only */
  125.     keyOriginalAddressAttr        = 'from',                        /* new in 1.0.1 */
  126. /* Keywords for special handlers */
  127.     keyPreDispatch                = 'phac',                        /* preHandler accessor call */
  128.     keySelectProc                = 'selh',                        /* more selector call */
  129. /* Keyword for recording */
  130.     keyAERecorderCount            = 'recr',                        /* available only in vers 1.0.1 and greater */
  131. /* Keyword for version information */
  132.     keyAEVersion                = 'vers',                        /* available only in vers 1.0.1 and greater */
  133. /* Event Class */
  134.     kCoreEventClass                = 'aevt',
  135. /* Event ID’s */
  136.     kAEOpenApplication            = 'oapp',
  137.     kAEOpenDocuments            = 'odoc',
  138.     kAEPrintDocuments            = 'pdoc',
  139.     kAEQuitApplication            = 'quit',
  140.     kAEAnswer                    = 'ansr',
  141.     kAEApplicationDied            = 'obit'
  142. };
  143.  
  144. enum {
  145. /* Constants for use in AESend mode */
  146.     kAENoReply                    = 0x00000001,                    /* sender doesn't want a reply to event */
  147.     kAEQueueReply                = 0x00000002,                    /* sender wants a reply but won't wait */
  148.     kAEWaitReply                = 0x00000003,                    /* sender wants a reply and will wait */
  149.     kAENeverInteract            = 0x00000010,                    /* server should not interact with user */
  150.     kAECanInteract                = 0x00000020,                    /* server may try to interact with user */
  151.     kAEAlwaysInteract            = 0x00000030,                    /* server should always interact with user where appropriate */
  152.     kAECanSwitchLayer            = 0x00000040,                    /* interaction may switch layer */
  153.     kAEDontReconnect            = 0x00000080,                    /* don't reconnect if there is a sessClosedErr from PPCToolbox */
  154.     kAEWantReceipt                = nReturnReceipt,                /* sender wants a receipt of message */
  155.     kAEDontRecord                = 0x00001000,                    /* don't record this event - available only in vers 1.0.1 and greater */
  156.     kAEDontExecute                = 0x00002000,                    /* don't send the event for recording - available only in vers 1.0.1 and greater */
  157. /* Constants for the send priority in AESend */
  158.     kAENormalPriority            = 0x00000000,                    /* post message at the end of the event queue */
  159.     kAEHighPriority                = nAttnMsg                        /* post message at the front of the event queue */
  160. };
  161.  
  162. enum {
  163. /* Constants for recording */
  164.     kAEStartRecording            = 'reca',                        /* available only in vers 1.0.1 and greater */
  165.     kAEStopRecording            = 'recc',                        /* available only in vers 1.0.1 and greater */
  166.     kAENotifyStartRecording        = 'rec1',                        /* available only in vers 1.0.1 and greater */
  167.     kAENotifyStopRecording        = 'rec0',                        /* available only in vers 1.0.1 and greater */
  168.     kAENotifyRecording            = 'recr'
  169. };
  170.  
  171. /* Constant for the returnID param of AECreateAppleEvent */
  172. enum {
  173.     kAutoGenerateReturnID        = -1,                            /* AECreateAppleEvent will generate a session-unique ID */
  174. /* Constant for transaction ID’s */
  175.     kAnyTransactionID            = 0,                            /* no transaction is in use */
  176. /* Constants for timeout durations */
  177.     kAEDefaultTimeout            = -1,                            /* timeout value determined by AEM */
  178.     kNoTimeOut                    = -2                            /* wait until reply comes back, however long it takes */
  179. };
  180.  
  181. /* Constants for AEResumeTheCurrentEvent */
  182. enum {
  183.     kAENoDispatch                = 0,                            /* dispatch parameter to AEResumeTheCurrentEvent takes a pointer to a dispatch */
  184.     kAEUseStandardDispatch        = 0xFFFFFFFF,                    /* table, or one of these two constants */
  185. /* Constants for Refcon in AEResumeTheCurrentEvent with kAEUseStandardDispatch */
  186.     kAEDoNotIgnoreHandler        = 0x00000000,
  187.     kAEIgnoreAppPhacHandler        = 0x00000001,                    /* available only in vers 1.0.1 and greater */
  188.     kAEIgnoreAppEventHandler    = 0x00000002,                    /* available only in vers 1.0.1 and greater */
  189.     kAEIgnoreSysPhacHandler        = 0x00000004,                    /* available only in vers 1.0.1 and greater */
  190.     kAEIgnoreSysEventHandler    = 0x00000008,                    /* available only in vers 1.0.1 and greater */
  191.     kAEIngoreBuiltInEventHandler = 0x00000010,                    /* available only in vers 1.0.1 and greater */
  192.     kAEDontDisposeOnResume        = 0x80000000                    /* available only in vers 1.0.1 and greater */
  193. };
  194.  
  195. /* Apple event manager data types */
  196. typedef FourCharCode AEEventClass;
  197.  
  198. typedef FourCharCode AEEventID;
  199.  
  200. typedef FourCharCode AEKeyword;
  201.  
  202. typedef ResType DescType;
  203.  
  204. struct AEDesc {
  205.     DescType                        descriptorType;
  206.     Handle                            dataHandle;
  207. };
  208. typedef struct AEDesc AEDesc;
  209.  
  210. struct AEKeyDesc {
  211.     AEKeyword                        descKey;
  212.     AEDesc                            descContent;
  213. };
  214. typedef struct AEKeyDesc AEKeyDesc;
  215.  
  216. /* an AEDesc which contains address data */
  217. typedef AEDesc AEAddressDesc;
  218.  
  219. /* a list of AEDesc's is a special kind of AEDesc */
  220. typedef AEDesc AEDescList;
  221.  
  222. /* AERecord is a list of keyworded AEDesc's */
  223. typedef AEDescList AERecord;
  224.  
  225. /* an AERecord that contains an AppleEvent */
  226. typedef AERecord AppleEvent;
  227.  
  228. /* parameter to AESend */
  229. typedef long AESendMode;
  230.  
  231. /* priority param of AESend */
  232. typedef short AESendPriority;
  233.  
  234.  
  235. enum {
  236.     kAEInteractWithSelf            = 0,
  237.     kAEInteractWithLocal        = 1,
  238.     kAEInteractWithAll            = 2
  239. };
  240.  
  241. typedef SInt8 AEInteractAllowed;
  242.  
  243.  
  244. enum {
  245.     kAEUnknownSource            = 0,
  246.     kAEDirectCall                = 1,
  247.     kAESameProcess                = 2,
  248.     kAELocalProcess                = 3,
  249.     kAERemoteProcess            = 4
  250. };
  251.  
  252. typedef SInt8 AEEventSource;
  253.  
  254.  
  255. enum {
  256.     kAEDataArray                = 0,
  257.     kAEPackedArray                = 1,
  258.     kAEHandleArray                = 2,
  259.     kAEDescArray                = 3,
  260.     kAEKeyDescArray                = 4
  261. };
  262.  
  263. typedef SInt8 AEArrayType;
  264.  
  265. union AEArrayData {
  266.     short                            kAEDataArray[1];
  267.     char                            kAEPackedArray[1];
  268.     Handle                            kAEHandleArray[1];
  269.     AEDesc                            kAEDescArray[1];
  270.     AEKeyDesc                        kAEKeyDescArray[1];
  271. };
  272. typedef union AEArrayData AEArrayData;
  273.  
  274. typedef AEArrayData *AEArrayDataPointer;
  275.  
  276. typedef pascal Boolean (*AEIdleProcPtr)(EventRecord *theEvent, long *sleepTime, RgnHandle *mouseRgn);
  277. typedef pascal Boolean (*AEFilterProcPtr)(EventRecord *theEvent, long returnID, long transactionID, const AEAddressDesc *sender);
  278. typedef pascal OSErr (*AEEventHandlerProcPtr)(const AppleEvent *theAppleEvent, AppleEvent *reply, long handlerRefcon);
  279. typedef pascal OSErr (*AECoerceDescProcPtr)(const AEDesc *fromDesc, DescType toType, long handlerRefcon, AEDesc *toDesc);
  280. typedef pascal OSErr (*AECoercePtrProcPtr)(DescType typeCode, const void *dataPtr, Size dataSize, DescType toType, long handlerRefcon, AEDesc *result);
  281.  
  282. #if GENERATINGCFM
  283. typedef UniversalProcPtr AEIdleUPP;
  284. typedef UniversalProcPtr AEFilterUPP;
  285. typedef UniversalProcPtr AEEventHandlerUPP;
  286. typedef UniversalProcPtr AECoerceDescUPP;
  287. typedef UniversalProcPtr AECoercePtrUPP;
  288. #else
  289. typedef AEIdleProcPtr AEIdleUPP;
  290. typedef AEFilterProcPtr AEFilterUPP;
  291. typedef AEEventHandlerProcPtr AEEventHandlerUPP;
  292. typedef AECoerceDescProcPtr AECoerceDescUPP;
  293. typedef AECoercePtrProcPtr AECoercePtrUPP;
  294. #endif
  295.  
  296. enum {
  297.     uppAEIdleProcInfo = kPascalStackBased
  298.          | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  299.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(EventRecord*)))
  300.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long*)))
  301.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(RgnHandle*))),
  302.     uppAEFilterProcInfo = kPascalStackBased
  303.          | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  304.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(EventRecord*)))
  305.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long)))
  306.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long)))
  307.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(AEAddressDesc*))),
  308.     uppAEEventHandlerProcInfo = kPascalStackBased
  309.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  310.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(AppleEvent*)))
  311.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(AppleEvent*)))
  312.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long))),
  313.     uppAECoerceDescProcInfo = kPascalStackBased
  314.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  315.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(AEDesc*)))
  316.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(DescType)))
  317.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long)))
  318.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(AEDesc*))),
  319.     uppAECoercePtrProcInfo = kPascalStackBased
  320.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  321.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DescType)))
  322.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(void*)))
  323.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Size)))
  324.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(DescType)))
  325.          | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(long)))
  326.          | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(AEDesc*)))
  327. };
  328.  
  329. #if GENERATINGCFM
  330. #define NewAEIdleProc(userRoutine)        \
  331.         (AEIdleUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppAEIdleProcInfo, GetCurrentArchitecture())
  332. #define NewAEFilterProc(userRoutine)        \
  333.         (AEFilterUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppAEFilterProcInfo, GetCurrentArchitecture())
  334. #define NewAEEventHandlerProc(userRoutine)        \
  335.         (AEEventHandlerUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppAEEventHandlerProcInfo, GetCurrentArchitecture())
  336. #define NewAECoerceDescProc(userRoutine)        \
  337.         (AECoerceDescUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppAECoerceDescProcInfo, GetCurrentArchitecture())
  338. #define NewAECoercePtrProc(userRoutine)        \
  339.         (AECoercePtrUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppAECoercePtrProcInfo, GetCurrentArchitecture())
  340. #else
  341. #define NewAEIdleProc(userRoutine)        \
  342.         ((AEIdleUPP) (userRoutine))
  343. #define NewAEFilterProc(userRoutine)        \
  344.         ((AEFilterUPP) (userRoutine))
  345. #define NewAEEventHandlerProc(userRoutine)        \
  346.         ((AEEventHandlerUPP) (userRoutine))
  347. #define NewAECoerceDescProc(userRoutine)        \
  348.         ((AECoerceDescUPP) (userRoutine))
  349. #define NewAECoercePtrProc(userRoutine)        \
  350.         ((AECoercePtrUPP) (userRoutine))
  351. #endif
  352.  
  353. #if GENERATINGCFM
  354. #define CallAEIdleProc(userRoutine, theEvent, sleepTime, mouseRgn)        \
  355.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppAEIdleProcInfo, (theEvent), (sleepTime), (mouseRgn))
  356. #define CallAEFilterProc(userRoutine, theEvent, returnID, transactionID, sender)        \
  357.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppAEFilterProcInfo, (theEvent), (returnID), (transactionID), (sender))
  358. #define CallAEEventHandlerProc(userRoutine, theAppleEvent, reply, handlerRefcon)        \
  359.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppAEEventHandlerProcInfo, (theAppleEvent), (reply), (handlerRefcon))
  360. #define CallAECoerceDescProc(userRoutine, fromDesc, toType, handlerRefcon, toDesc)        \
  361.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppAECoerceDescProcInfo, (fromDesc), (toType), (handlerRefcon), (toDesc))
  362. #define CallAECoercePtrProc(userRoutine, typeCode, dataPtr, dataSize, toType, handlerRefcon, result)        \
  363.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppAECoercePtrProcInfo, (typeCode), (dataPtr), (dataSize), (toType), (handlerRefcon), (result))
  364. #else
  365. #define CallAEIdleProc(userRoutine, theEvent, sleepTime, mouseRgn)        \
  366.         (*(userRoutine))((theEvent), (sleepTime), (mouseRgn))
  367. #define CallAEFilterProc(userRoutine, theEvent, returnID, transactionID, sender)        \
  368.         (*(userRoutine))((theEvent), (returnID), (transactionID), (sender))
  369. #define CallAEEventHandlerProc(userRoutine, theAppleEvent, reply, handlerRefcon)        \
  370.         (*(userRoutine))((theAppleEvent), (reply), (handlerRefcon))
  371. #define CallAECoerceDescProc(userRoutine, fromDesc, toType, handlerRefcon, toDesc)        \
  372.         (*(userRoutine))((fromDesc), (toType), (handlerRefcon), (toDesc))
  373. #define CallAECoercePtrProc(userRoutine, typeCode, dataPtr, dataSize, toType, handlerRefcon, result)        \
  374.         (*(userRoutine))((typeCode), (dataPtr), (dataSize), (toType), (handlerRefcon), (result))
  375. #endif
  376.  
  377. typedef UniversalProcPtr AECoercionHandlerUPP;
  378.  
  379. /**************************************************************************
  380.  The following calls apply to any AEDesc. Every 'result' descriptor is
  381.  created for you, so you will be responsible for memory management
  382.  (including disposing) of the descriptors so created. Note: purgeable
  383.  descriptor data is not supported - the AEM does not call LoadResource.  
  384. **************************************************************************/
  385. extern pascal OSErr AECreateDesc(DescType typeCode, const void *dataPtr, Size dataSize, AEDesc *result)
  386.  THREEWORDINLINE(0x303C, 0x0825, 0xA816);
  387. extern pascal OSErr AECoercePtr(DescType typeCode, const void *dataPtr, Size dataSize, DescType toType, AEDesc *result)
  388.  THREEWORDINLINE(0x303C, 0x0A02, 0xA816);
  389. extern pascal OSErr AECoerceDesc(const AEDesc *theAEDesc, DescType toType, AEDesc *result)
  390.  THREEWORDINLINE(0x303C, 0x0603, 0xA816);
  391. extern pascal OSErr AEDisposeDesc(AEDesc *theAEDesc)
  392.  THREEWORDINLINE(0x303C, 0x0204, 0xA816);
  393. extern pascal OSErr AEDuplicateDesc(const AEDesc *theAEDesc, AEDesc *result)
  394.  THREEWORDINLINE(0x303C, 0x0405, 0xA816);
  395. /**************************************************************************
  396.   The following calls apply to AEDescList. Since AEDescList is a subtype of
  397.   AEDesc, the calls in the previous section can also be used for AEDescList.
  398.   All list and array indices are 1-based. If the data was greater than
  399.   maximumSize in the routines below, then actualSize will be greater than
  400.   maximumSize, but only maximumSize bytes will actually be retrieved.
  401. **************************************************************************/
  402. extern pascal OSErr AECreateList(const void *factoringPtr, Size factoredSize, Boolean isRecord, AEDescList *resultList)
  403.  THREEWORDINLINE(0x303C, 0x0706, 0xA816);
  404. extern pascal OSErr AECountItems(const AEDescList *theAEDescList, long *theCount)
  405.  THREEWORDINLINE(0x303C, 0x0407, 0xA816);
  406. extern pascal OSErr AEPutPtr(AEDescList *theAEDescList, long index, DescType typeCode, const void *dataPtr, Size dataSize)
  407.  THREEWORDINLINE(0x303C, 0x0A08, 0xA816);
  408. extern pascal OSErr AEPutDesc(AEDescList *theAEDescList, long index, const AEDesc *theAEDesc)
  409.  THREEWORDINLINE(0x303C, 0x0609, 0xA816);
  410. extern pascal OSErr AEGetNthPtr(const AEDescList *theAEDescList, long index, DescType desiredType, AEKeyword *theAEKeyword, DescType *typeCode, void *dataPtr, Size maximumSize, Size *actualSize)
  411.  THREEWORDINLINE(0x303C, 0x100A, 0xA816);
  412. extern pascal OSErr AEGetNthDesc(const AEDescList *theAEDescList, long index, DescType desiredType, AEKeyword *theAEKeyword, AEDesc *result)
  413.  THREEWORDINLINE(0x303C, 0x0A0B, 0xA816);
  414. extern pascal OSErr AESizeOfNthItem(const AEDescList *theAEDescList, long index, DescType *typeCode, Size *dataSize)
  415.  THREEWORDINLINE(0x303C, 0x082A, 0xA816);
  416. extern pascal OSErr AEGetArray(const AEDescList *theAEDescList, AEArrayType arrayType, AEArrayDataPointer arrayPtr, Size maximumSize, DescType *itemType, Size *itemSize, long *itemCount)
  417.  THREEWORDINLINE(0x303C, 0x0D0C, 0xA816);
  418. extern pascal OSErr AEPutArray(AEDescList *theAEDescList, AEArrayType arrayType, const AEArrayData *arrayPtr, DescType itemType, Size itemSize, long itemCount)
  419.  THREEWORDINLINE(0x303C, 0x0B0D, 0xA816);
  420. extern pascal OSErr AEDeleteItem(AEDescList *theAEDescList, long index)
  421.  THREEWORDINLINE(0x303C, 0x040E, 0xA816);
  422. /**************************************************************************
  423.  The following calls apply to AERecord. Since AERecord is a subtype of
  424.  AEDescList, the calls in the previous sections can also be used for
  425.  AERecord an AERecord can be created by using AECreateList with isRecord
  426.  set to true. 
  427. **************************************************************************/
  428. #define AEPutKeyPtr(theAERecord, theAEKeyword, typeCode, dataPtr, dataSize)  \
  429.     AEPutParamPtr((theAERecord), (theAEKeyword), (typeCode), (dataPtr), (dataSize))
  430. #define AEPutKeyDesc(theAERecord, theAEKeyword, theAEDesc)  \
  431.     AEPutParamDesc((theAERecord), (theAEKeyword), (theAEDesc))
  432. #define AEGetKeyPtr(theAERecord, theAEKeyword, desiredType, typeCode, dataPtr, maxSize, actualSize)  \
  433.     AEGetParamPtr((theAERecord), (theAEKeyword), (desiredType), (typeCode), (dataPtr), (maxSize), (actualSize))
  434. #define AEGetKeyDesc(theAERecord, theAEKeyword, desiredType, result)  \
  435.     AEGetParamDesc((theAERecord), (theAEKeyword), (desiredType), (result))
  436. #define AESizeOfKeyDesc(theAERecord, theAEKeyword, typeCode, dataSize)  \
  437.     AESizeOfParam((theAERecord), (theAEKeyword), (typeCode), (dataSize))
  438. #define AEDeleteKeyDesc(theAERecord, theAEKeyword)  \
  439.     AEDeleteParam((theAERecord), (theAEKeyword))
  440. extern pascal OSErr AEPutParamPtr(AppleEvent *theAppleEvent, AEKeyword theAEKeyword, DescType typeCode, const void *dataPtr, Size dataSize)
  441.  THREEWORDINLINE(0x303C, 0x0A0F, 0xA816);
  442. extern pascal OSErr AEPutParamDesc(AppleEvent *theAppleEvent, AEKeyword theAEKeyword, const AEDesc *theAEDesc)
  443.  THREEWORDINLINE(0x303C, 0x0610, 0xA816);
  444. extern pascal OSErr AEGetParamPtr(const AppleEvent *theAppleEvent, AEKeyword theAEKeyword, DescType desiredType, DescType *typeCode, void *dataPtr, Size maximumSize, Size *actualSize)
  445.  THREEWORDINLINE(0x303C, 0x0E11, 0xA816);
  446. extern pascal OSErr AEGetParamDesc(const AppleEvent *theAppleEvent, AEKeyword theAEKeyword, DescType desiredType, AEDesc *result)
  447.  THREEWORDINLINE(0x303C, 0x0812, 0xA816);
  448. extern pascal OSErr AESizeOfParam(const AppleEvent *theAppleEvent, AEKeyword theAEKeyword, DescType *typeCode, Size *dataSize)
  449.  THREEWORDINLINE(0x303C, 0x0829, 0xA816);
  450. extern pascal OSErr AEDeleteParam(AppleEvent *theAppleEvent, AEKeyword theAEKeyword)
  451.  THREEWORDINLINE(0x303C, 0x0413, 0xA816);
  452. /**************************************************************************
  453.  The following calls also apply to type AppleEvent. Message attributes are
  454.  far more restricted, and can only be accessed through the following 5
  455.  calls. The various list and record routines cannot be used to access the
  456.  attributes of an event. 
  457. **************************************************************************/
  458. extern pascal OSErr AEGetAttributePtr(const AppleEvent *theAppleEvent, AEKeyword theAEKeyword, DescType desiredType, DescType *typeCode, void *dataPtr, Size maximumSize, Size *actualSize)
  459.  THREEWORDINLINE(0x303C, 0x0E15, 0xA816);
  460. extern pascal OSErr AEGetAttributeDesc(const AppleEvent *theAppleEvent, AEKeyword theAEKeyword, DescType desiredType, AEDesc *result)
  461.  THREEWORDINLINE(0x303C, 0x0826, 0xA816);
  462. extern pascal OSErr AESizeOfAttribute(const AppleEvent *theAppleEvent, AEKeyword theAEKeyword, DescType *typeCode, Size *dataSize)
  463.  THREEWORDINLINE(0x303C, 0x0828, 0xA816);
  464. extern pascal OSErr AEPutAttributePtr(AppleEvent *theAppleEvent, AEKeyword theAEKeyword, DescType typeCode, const void *dataPtr, Size dataSize)
  465.  THREEWORDINLINE(0x303C, 0x0A16, 0xA816);
  466. extern pascal OSErr AEPutAttributeDesc(AppleEvent *theAppleEvent, AEKeyword theAEKeyword, const AEDesc *theAEDesc)
  467.  THREEWORDINLINE(0x303C, 0x0627, 0xA816);
  468. /**************************************************************************
  469.   The next couple of calls are basic routines used to create, send,
  470.   and process AppleEvents. 
  471. **************************************************************************/
  472. extern pascal OSErr AECreateAppleEvent(AEEventClass theAEEventClass, AEEventID theAEEventID, const AEAddressDesc *target, short returnID, long transactionID, AppleEvent *result)
  473.  THREEWORDINLINE(0x303C, 0x0B14, 0xA816);
  474. extern pascal OSErr AESend(const AppleEvent *theAppleEvent, AppleEvent *reply, AESendMode sendMode, AESendPriority sendPriority, long timeOutInTicks, AEIdleUPP idleProc, AEFilterUPP filterProc)
  475.  THREEWORDINLINE(0x303C, 0x0D17, 0xA816);
  476. extern pascal OSErr AEProcessAppleEvent(const EventRecord *theEventRecord)
  477.  THREEWORDINLINE(0x303C, 0x021B, 0xA816);
  478. /* 
  479.  Note: during event processing, an event handler may realize that it is likely
  480.  to exceed the client's timeout limit. Passing the reply to this
  481.  routine causes a wait event to be generated that asks the client
  482.  for more time. 
  483. */
  484. extern pascal OSErr AEResetTimer(const AppleEvent *reply)
  485.  THREEWORDINLINE(0x303C, 0x0219, 0xA816);
  486. /**************************************************************************
  487.  The following four calls are available for applications which need more
  488.  sophisticated control over when and how events are processed. Applications
  489.  which implement multi-session servers or which implement their own
  490.  internal event queueing will probably be the major clients of these
  491.  routines. They can be called from within a handler to prevent the AEM from
  492.  disposing of the AppleEvent when the handler returns. They can be used to
  493.  asynchronously process the event (as MacApp does).
  494. **************************************************************************/
  495. extern pascal OSErr AESuspendTheCurrentEvent(const AppleEvent *theAppleEvent)
  496.  THREEWORDINLINE(0x303C, 0x022B, 0xA816);
  497. /* 
  498.  Note: The following routine tells the AppleEvent manager that processing
  499.  is either about to resume or has been completed on a previously suspended
  500.  event. The procPtr passed in as the dispatcher parameter will be called to
  501.  attempt to redispatch the event. Several constants for the dispatcher
  502.  parameter allow special behavior. They are:
  503.       - kAEUseStandardDispatch means redispatch as if the event was just
  504.       received, using the standard AppleEvent dispatch mechanism.
  505.       - kAENoDispatch means ignore the parameter.
  506.          Use this in the case where the event has been handled and no
  507.       redispatch is needed.
  508.       - non nil means call the routine which the dispatcher points to.
  509. */
  510. extern pascal OSErr AEResumeTheCurrentEvent(const AppleEvent *theAppleEvent, const AppleEvent *reply, AEEventHandlerUPP dispatcher, long handlerRefcon)
  511.  THREEWORDINLINE(0x303C, 0x0818, 0xA816);
  512. extern pascal OSErr AEGetTheCurrentEvent(AppleEvent *theAppleEvent)
  513.  THREEWORDINLINE(0x303C, 0x021A, 0xA816);
  514. extern pascal OSErr AESetTheCurrentEvent(const AppleEvent *theAppleEvent)
  515.  THREEWORDINLINE(0x303C, 0x022C, 0xA816);
  516. /**************************************************************************
  517.   The following three calls are used to allow applications to behave
  518.   courteously when a user interaction such as a dialog box is needed. 
  519. **************************************************************************/
  520. extern pascal OSErr AEGetInteractionAllowed(AEInteractAllowed *level)
  521.  THREEWORDINLINE(0x303C, 0x021D, 0xA816);
  522. extern pascal OSErr AESetInteractionAllowed(AEInteractAllowed level)
  523.  THREEWORDINLINE(0x303C, 0x011E, 0xA816);
  524. extern pascal OSErr AEInteractWithUser(long timeOutInTicks, NMRecPtr nmReqPtr, AEIdleUPP idleProc)
  525.  THREEWORDINLINE(0x303C, 0x061C, 0xA816);
  526. /**************************************************************************
  527.   These calls are used to set up and modify the event dispatch table.
  528. **************************************************************************/
  529. extern pascal OSErr AEInstallEventHandler(AEEventClass theAEEventClass, AEEventID theAEEventID, AEEventHandlerUPP handler, long handlerRefcon, Boolean isSysHandler)
  530.  THREEWORDINLINE(0x303C, 0x091F, 0xA816);
  531. extern pascal OSErr AERemoveEventHandler(AEEventClass theAEEventClass, AEEventID theAEEventID, AEEventHandlerUPP handler, Boolean isSysHandler)
  532.  THREEWORDINLINE(0x303C, 0x0720, 0xA816);
  533. extern pascal OSErr AEGetEventHandler(AEEventClass theAEEventClass, AEEventID theAEEventID, AEEventHandlerUPP *handler, long *handlerRefcon, Boolean isSysHandler)
  534.  THREEWORDINLINE(0x303C, 0x0921, 0xA816);
  535. /**************************************************************************
  536.   These calls are used to set up and modify the coercion dispatch table.
  537. **************************************************************************/
  538. extern pascal OSErr AEInstallCoercionHandler(DescType fromType, DescType toType, AECoercionHandlerUPP handler, long handlerRefcon, Boolean fromTypeIsDesc, Boolean isSysHandler)
  539.  THREEWORDINLINE(0x303C, 0x0A22, 0xA816);
  540. extern pascal OSErr AERemoveCoercionHandler(DescType fromType, DescType toType, AECoercionHandlerUPP handler, Boolean isSysHandler)
  541.  THREEWORDINLINE(0x303C, 0x0723, 0xA816);
  542. extern pascal OSErr AEGetCoercionHandler(DescType fromType, DescType toType, AECoercionHandlerUPP *handler, long *handlerRefcon, Boolean *fromTypeIsDesc, Boolean isSysHandler)
  543.  THREEWORDINLINE(0x303C, 0x0B24, 0xA816);
  544. /**************************************************************************
  545.   These calls are used to set up and modify special hooks into the
  546.   AppleEvent manager.
  547. **************************************************************************/
  548. extern pascal OSErr AEInstallSpecialHandler(AEKeyword functionClass, UniversalProcPtr handler, Boolean isSysHandler)
  549.  THREEWORDINLINE(0x303C, 0x0500, 0xA816);
  550. extern pascal OSErr AERemoveSpecialHandler(AEKeyword functionClass, UniversalProcPtr handler, Boolean isSysHandler)
  551.  THREEWORDINLINE(0x303C, 0x0501, 0xA816);
  552. extern pascal OSErr AEGetSpecialHandler(AEKeyword functionClass, UniversalProcPtr *handler, Boolean isSysHandler)
  553.  THREEWORDINLINE(0x303C, 0x052D, 0xA816);
  554. /**************************************************************************
  555.   This call was added in version 1.0.1. If called with the keyword
  556.   keyAERecorderCount ('recr'), the number of recorders that are
  557.   currently active is returned in 'result'.
  558. **************************************************************************/
  559. /* available only in vers 1.0.1 and greater */
  560. extern pascal OSErr AEManagerInfo(AEKeyword keyWord, long *result)
  561.  THREEWORDINLINE(0x303C, 0x0441, 0xA816);
  562.  
  563. #if PRAGMA_IMPORT_SUPPORTED
  564. #pragma import off
  565. #endif
  566.  
  567. #if PRAGMA_ALIGN_SUPPORTED
  568. #pragma options align=reset
  569. #endif
  570.  
  571. #ifdef __cplusplus
  572. }
  573. #endif
  574.  
  575. #endif /* __APPLEEVENTS__ */
  576.